<?php

namespace app\common\validate;

use think\Validate;

//用户模型验证器
class Users extends Validate
{
    protected $rule = [
        'username' => 'require|max:15|unique:users',
        'password' => 'require',
        'password2' => 'require|confirm:password'
    ];

    protected $message = [
        'username.require' => '名称必须填写',
        'username.max' => '名称不能大于15个字',
        'username.unique' => '名称已经存在，请重新填写',
        'password.require' => '密码必须填写',
        'password2.require' => '重复密码必须填写',
        'password2.confirm' => '重复密码不一致',

    ];

    protected $scene = [
        'add' => ['username', 'password', 'password2'],
        'edit' => ['username']
    ];
}
